package dao

import (
	"fmt"

	"gorm.io/gorm"
)

type AccountAudit struct{}

func (a *AccountAudit) Preload(db *gorm.DB) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Preload("Account")
	}
}

func (a *AccountAudit) GetAccountAuditList(regionLink string, db *gorm.DB) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("region_link REGEXP ?", fmt.Sprintf("(%v)", regionLink)).Scopes(a.Preload(db))
	}
}

var AccountAuditDao = new(AccountAudit)
